package com.zhao.algorithm.utils

import com.typesafe.config.{Config, ConfigFactory}
import redis.clients.jedis.{Jedis, JedisPool}

/**
 * Description: <br/>
 * Copyright (c) ，2020 ， 赵 <br/>
 * This program is protected by copyright laws. <br/>
 * Date： 2020/11/23 10:26
 *
 * @author 柒柒
 * @version : 1.0
 */

object OpRedis {
  val load: Config = ConfigFactory.load("redis.properties")

  // redis 连接池，可以懒加载，不用不加载
  private lazy val Jpool = new JedisPool(load.getString("redis.url"), load.getInt("redis.port"))

  def getJedis(): Jedis = {
    Jpool.getResource
  }

}
